#include <stdio.h>
#include <stdlib.h>
void InputScore(int* p, int n);
void ArrayScore(int* p, int n);
void MaxScore(int* p, int n);
void MinScore(int* p, int n);

int main()
{
    int* p = NULL, n;
    printf("input the number of students: ");
    scanf("%d", &n);
    p = (int*)malloc(n * sizeof(int));
    if (p == NULL)
    {
        printf("no enough memory\n");
        exit(1);
    }
    printf("input %d score: ", n);
    InputScore(p, n);
    ArrayScore(p, n);
    MaxScore(p, n);
    MinScore(p, n);
    free(p);
    return 0;

    return 0;
}
void InputScore(int* p, int n)
{
    int i;
    for (i = 0; i < n; i++)
    {
        scanf("%d", &p[i]);
    }
}
void ArrayScore(int* p, int n)
{
    int i, sum = 0;
    double aver;
    for (i = 0; i < n; i++)
    {
        sum += p[i];
    }
    aver = (double)sum / n;
    printf("average score is %f\n", aver);
}
void MaxScore(int* p, int n)
{
    int i = 0, max;
    max = p[i];
    for (i = 0; i < n; i++)
    {
        if (p[i] > max)
            max = p[i];
    }
    printf("maximum score is %d\n", max);
}
void MinScore(int* p, int n)
{
    int  i = 0, min;
    min = p[i];
    for (i = 0; i < n; i++)
    {
        if (p[i] < min)
            min = p[i];
    }
    printf("minimum score is %d\n", min);
}